package db;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;


public final class Dbclose {
    public static void close(Statement stmt, Connection conn)
    {
            try{
            if(stmt != null) stmt.close();
        } catch(SQLException e){
            e.printStackTrace();
        }

        try{
            if(conn != null) conn.close();
        }catch(SQLException e){
            e.printStackTrace();
        }
    }
        public static void close(PreparedStatement pstmt, Connection conn)
    {
            try{
            if(pstmt != null) pstmt.close();
        } catch(SQLException e){
            e.printStackTrace();
        }

        try{
            if(conn != null) conn.close();
        }catch(SQLException e){
            e.printStackTrace();
        }
    }
    public static void queryClose(Statement stmt,ResultSet rs,Connection conn){
        try{
            if(stmt != null) stmt.close();
        } catch(SQLException e){
            e.printStackTrace();
        }

        try{
            if(rs != null) conn.close();
        }catch(SQLException e){
            e.printStackTrace();
        }
        try{
            if(conn != null) conn.close();
        }catch(SQLException e){
            e.printStackTrace();
        }
    }
    public static void queryClose(PreparedStatement pstmt,ResultSet rs,Connection conn){
        try{
            if(pstmt != null) pstmt.close();
        } catch(SQLException e){
            e.printStackTrace();
        }

        try{
            if(rs != null) conn.close();
        }catch(SQLException e){
            e.printStackTrace();
        }
        try{
            if(conn != null) conn.close();
        }catch(SQLException e){
            e.printStackTrace();
        }
    }

    
}
